package com.futuristik.modes;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Image.Scaling;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;

public class WinMode extends ArkitekMode {

	Skin skin;
	Stage ui;

	public WinMode (Game game) {
		super(game);
	}

	@Override
	public void show () {
		ui = new Stage(480, 320, true);

		skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));

		
		
		Image sBackground = new Image(new TextureRegion(new Texture(Gdx.files.internal("data/obj/blackSquare.jpg"))), Scaling.none, "background");
		Image background = new Image(new TextureRegion(new Texture(Gdx.files.internal("data/obj/WIN.jpeg"))), Scaling.none, "background");
		background.y = 30;
		background.x = -15;
		
		//Create the back button
		/* UNUSED 
		Button back = new Button("Back to Main Menu", skin.getStyle(ButtonStyle.class), "backButton");
		
		back.y = 10;
		back.x = 50;
		back.width = 150;
		back.height = 50;
		
		back.setClickListener(new ClickListener(){
			@Override
			public void click(Actor actor) {
					game.setScreen(new MainMenu(game));
				}
			});
		*/
		
		
		ui.addActor(sBackground);
		ui.addActor(background);
		//Unused ui.addActor(back);
		
		

		Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
		Gdx.input.setInputProcessor(ui);	
	}
	
	//Button to return to main menu
	
	
	@Override
	public void render (float deltaTime) {
		ui.draw();


		if(Gdx.input.isTouched()){
			game.setScreen(new MainMenu(game));
		}
		
		if (Gdx.input.isKeyPressed(Keys.ESCAPE)) {
			game.setScreen(new MainMenu(game));
		}
	}

	@Override
	public void pause () {
	}

	@Override
	public void resume () {
	}

	@Override
	public void dispose () {
	}

	@Override
	public void hide () {
		ui.clear();
		ui.dispose();
	}
}